package com.seguridad.txwrapping;

import java.net.MalformedURLException;
import java.net.URL;

import com.seguridad.txwrapping.tester.WSSWOptionalTester;
import com.seguridad.txwrapping.tester.WSSWSiblingTester;
import com.seguridad.txwrapping.tester.WSSWSimpleAncestryTester;
import com.seguridad.txwrapping.tester.WSSWTester;

public class WSSWrapperTesterBuilder {

	public static WSSWTester build(TestType testType, String url,
			String validMessagePath, String elementName,
			String elementToDuplicate) {
		
		WSSWTester tester = null;
		try {
			URL endpoint = new URL(url);
			
			switch (testType) {
			case SIMPLE:
				tester = new WSSWSimpleAncestryTester(endpoint, validMessagePath, elementName);
				break;
			case OPTIONAL:
				tester = new WSSWOptionalTester(endpoint, validMessagePath, elementName);
				break;
			case SIBLING:
				tester = new WSSWSiblingTester(endpoint, validMessagePath, elementName, elementToDuplicate);
				break;
			default:
				break;
			}
		
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
		
		return tester;
	}

}
